package scau.redi.social_platform.service.impl;

import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import scau.redi.social_platform.common.util.ResponsePageUtil;
import scau.redi.social_platform.dao.SharedContentMapper;
import scau.redi.social_platform.domain.pojo.Shared;
import scau.redi.social_platform.domain.pojo.SharedContent;
import scau.redi.social_platform.service.SharedContentService;

import java.util.List;

/**
 * @Author: Redi
 * @Date: 2022/5/5 20:31
 * @Description:
 */
@Service
public class SharedContentSeriviceImpl implements SharedContentService {

    @Autowired
    SharedContentMapper sharedContentMapper;

    @Override
    public int createsharedContent(SharedContent sharedContent) {
        if (sharedContentMapper.insertSelective(sharedContent)>0){
            return sharedContentMapper.selectLastInsertId();
        }
        return 0;
    }

    @Override
    public int deletesharedContent(int sharedId) {
        return sharedContentMapper.deleteByPrimaryKey(sharedId);
    }

    @Override
    public int updatesharedContent(SharedContent sharedContent) {
        return sharedContentMapper.updateByPrimaryKeySelective(sharedContent);
    }

    @Override
    public SharedContent findContentById(int sharedContentId) {
        return sharedContentMapper.selectByPrimaryKey(sharedContentId);
    }

    @Override
    public SharedContent findContentBySharedId(int sharedId){
        return sharedContentMapper.selectBySharedId(sharedId);
    }


}
